home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
EDITORS
/
VI
/
VIM
/
SOURCE
/
vim
/
doc
/
vim_hlp
< prev
next >
Wrap
Text File
|
1992-08-04
|
27KB
|
481 lines
VIM help file index
RETURN quit help VIM stands for Vi IMproved.
SPACE one page forward Most of VIM was made by Bram Moolenaar.
a go to this index VIM is based on Stevie, worked on by: Tim
b one page backward Thompson, Tony Andrews, G.R. (Fred) Walter
c left-right and up-down motions n key mapping; abbreviations
d word and text object motions o option commands, options a-e
e pattern searches p options e-p
f various motions; using tags q options r-s
g scrolling r options t-z
h inserting text; digraphs s undo; shell; quickfix; various
i insert mode t command line editing
j changing text u Ex ranges; Ex special characters
k complex changes v editing files; using the file list
l deleting, copying, moving text w writing and quitting
m repeating commands x starting VIM
Read "reference.doc" for a more complete explanation.
Left-right motions
N h left (same as CTRL-H, BS and cursor-left key)
N l right (same as SPACE and cursor-right key)
0 to first character in the line
^ to first non-blank character in the line
N $ to the last character in the line (N-1 lines lower)
N | to column N
N f<char> to the Nth occurrence of <char> to the right
N F<char> to the Nth occurrence of <char> to the left
N t<char> till before the Nth occurrence of <char> to the right
N T<char> till before the Nth occurrence of <char> to the left
N ; repeat the last f, F, t or T N times
N , repeat the last f, F, t or T N times in opposite direction
Up-down motions
N k up (same as CTRL-P and cursor-up key)
N j down (same as CTRL-J, CTRL-N, LF and cursor-down key)
N - up, on the first non-blank character
N + down, on the first non-blank char. (same as CTRL-M and CR)
N _ N - 1 lines down, on the first non-blank character
N G goto line N (default last line), on the first non-blank char.
N % goto line N percentage down in the file.
Word motions
N w N words forward
N W N blank-separated words forward
N e forward to the end of the Nth word
N E forward to the end of the Nth blank-separated word
N b N words backward
N B N blank-separated words backward
Text object motions
N ) N sentences forward
N ( N sentences backward
N } N paragraphs forward
N { N paragraphs backward
N ]] N sections forward
N [[ N sections backward
N ][ N sections (starting with a <}>) forward
N [] N sections (starting with a <}>) backward
Pattern searches
N /{pattern}[/] search forward for the Nth occurrence of {pattern}
N ?{pattern}[?] search backward for the Nth occurrence of {pattern}
N / repeat last search, in the forward direction
N ? repeat last search, in the backward direction
N n repeat last search
N N repeat last search, in opposite direction
N * search forward for the ident under the cursor
N # search backward for the ident under the cursor
special characters in search patterns magic nomagic
matches any single character . \.
matches start of line ^ ^
matches end of line $ $
matches start of word \< \<
matches end of word \> \>
matches a single char from the range [a-z] \[a-z]
matches a single char not in the range [^a-z] \[^a-z]
matches 0 or more of the preceding atom * \*
matches 1 or more of the preceding atom \+ \+
matches 0 or 1 of the preceding atom \? \?
separates two branches \| \|
group a pattern into an atom \(\) \(\)
Various motions
m<a-zA-Z> mark current position with mark <a-zA-Z>
`<a-zA-Z> go to mark <a-zA-Z>
`` go to the position before the last jump
`[ or `] go to the start or end of the previously operated or put text
'<a-zA-Z[]'> same as `, but on the first non-blank in the line
:marks print the active marks
N CTRL-O go to N older position in jump list
N CTRL-I go to N newer position in jump list
:jumps print the jump list
% find the next brace or bracket in this line, go to its match
N H go to the Nth line in the window, on the first non-blank
M go to the middle line in the window, on the first non-blank
N L go to the Nth line from the bottom, on the first non-blank
Using tags
:ta[g] {tag} Jump to tag {tag}, unless changes have been made
:ta[g]! {tag} Jump to tag {tag} always. Discard any changes
CTRL-] Jump to the tag under cursor, unless changes made
N CTRL-T Jump to N older tag in tag list
:[count]po[p][!] Jump to [count] older tag in tag list
:[count]ta[g][!] Jump to [count] newer tag in tag list
:tags Print tag list
Scrolling
N CTRL-E window N lines downwards (N lines Extra)
N CTRL-D window N lines Downwards (default half a window)
N CTRL-F window N pages Forwards (downwards)
N CTRL-Y window N lines upwards
N CTRL-U window N lines Upwards (default half a window)
N CTRL-B window N pages Backwards (upwards)
z<CR> redraw, current line at top of window
z. redraw, current line at center of window
z- redraw, current line at bottom of window
Inserting text
N a append text after the cursor (N times)
N A append text at the end of the line (N times)
N i insert text before the cursor (N times)
N I insert text before the first non-blank in the line (N times)
N o open a new line below the current line, append text (N times)
N O open a new line above the current line, append text (N times)
Special inserts
:r {file} insert the contents of {file} below the cursor
:r!{command} insert the standard output of {command} below the cursor
Digraphs
:dig[raphs] show current list of digraphs
:dig[raphs] {char1}{char2} {number} ...
add digraph(s) to the list
char action in insert mode
CTRL-[ or <ESC> end insert or replace mode, back to command mode
CTRL-A insert previously inserted text
CTRL-R <0-9a-z> insert contents of register <0-9a-z>
CTRL-@ insert previously inserted text and stop insert
CTRL-J or <LF> or CTRL-M or <CR> begin new line
CTRL-K {char1} {char2} enter digraph
CTRL-E insert the character which is below the cursor
CTRL-Y insert the character which is above the cursor
CTRL-V insert character literally, or enter decimal byte value
CTRL-H or <BS> or <DEL> delete the character before the cursor
CTRL-W delete word before the cursor
CTRL-U delete all entered characters in the current line
CTRL-T insert one shiftwidth of indent in the current line
CTRL-D delete one shiftwidth of indent in the current line
0 CTRL-D or ^ CTRL-D delete all indent in the current line
{char1} <BS> {char2} enter digraph if 'dg' option set
CTRL-P toggle 'revins' (reverse insert) option
keys that stop insert, do something and get back to insert:
cursor keys move cursor left/right/up/down
shift-up/down one screenfull backward/forward
shift-left/right one word left/right
CTRL-O {command} execute {command}
Changing text
N R enter replace mode (repeat the entered text N times)
N c{motion} change the text that is moved over with {motion}
{visual}c change the highlighted text
N cc change N lines
N C change to end of line (and N-1 more lines)
N s change N characters
N S change N lines
N r<char> replace N characters by <char>
N ~ switch case for N characters and advance cursor
{visual}~ switch case for highlighted text
{visual}u make highlighted text uppercase
{visual}U make highlighted text lowercase
N CTRL-A add N to the number at or after the cursor
N CTRL-S subtract N from the number at or after the cursor
N <{motion} move the lines that are moved over one shiftwidth left
N << move N lines one shiftwidth left
N >{motion} move the lines that are moved over one shiftwidth right
N >> move N lines one shiftwidth right
N Q{motion} format the lines that are moved over to 'textwidth' length
:[range]ce[nter] [width] center the lines in [range]
:[range]le[ft] [indent] left align the lines in [range] [with indent]
:[range]ri[ght] [width] right align the lines in [range]
Complex changes
v start highlighting characters } move cursor and use
V start highlighting linewise } operator to affect
CTRL-V start highlighting blockwise } highlighted text
o exchange cursor position with start of highlighting
N !{motion}{command}
filter the lines that are moved over through {command}
N !!{command}
filter N lines through {command}
:[range]!{command}
filter [range] lines through {command}
N ={motion}{command}
filter the lines that are moved over through "indent"
N =={command}
filter N lines through "indent"
:[range]s[ubstitute]/{pattern}/{string}/[g][c]
substitute {pattern} by {string} in [range] lines; with [g]
replace all occurrences of {pattern}; with [c] ask first
:[range]s[ubstitute] [g][c]
repeat previous :s with new range and options
& Repeat previous :s on current line without options
Deleting text
N x delete N characters under and after the cursor
N X delete N characters before the cursor
N d{motion} delete the text that is moved over with {motion}
{visual}d delete the highlighted text
N dd delete N lines
N D delete to end of line (and N-1 more lines)
N J join N-1 lines (delete newlines)
{visual}J join the highlighted lines
:[range]d ["x] delete [range] lines (into register ["x])
Copying and moving text
"<char> use register <char> for the next delete, yank or put
:dis show the current register contents
N y{motion} yank the text, moved over with {motion}, into a register
{visual}y yank the highlighted text into a register
N yy yank N lines into a register
N Y yank N lines into a register
N p put a register after the cursor position (N times)
N P put a register before the cursor position (N times)
Repeating commands
N . repeat last change (with count replaced by N)
q<a-z> record typed characters into register <a-z>
q stop recording
N @<a-z> execute the contents of register <a-z> (N times)
N @@ repeat previous @<a-z> (N times)
:@<a-z> execute the contents of register <a-z> as an Ex command
:@@ repeat previous :@<a-z>
:[range]g[lobal]/{pattern}/[cmd]
Execute Ex command [cmd] (default :p) on the lines within
[range] where {pattern} matches.
:[range]g[lobal]!/{pattern}/[cmd]
Execute Ex command [cmd] (default :p) on the lines within
[range] where {pattern} does NOT match.
:so[urce] {file}
Read Ex commands from {file}.
:so[urce]! {file}
Read VIM commands from {file}.
Key mapping
:ma[p] {lhs} {rhs} Map {lhs} to {rhs} in normal mode.
:ma[p]! {lhs} {rhs} Map {lhs} to {rhs} in insert and command line mode.
:no[remap][!] {lhs} {rhs}
Same as :map, no remapping for this {rhs}
:unm[ap] {lhs} Remove the mapping of {lhs} for normal mode.
:unm[ap]! {lhs} Remove the mapping of {lhs} for insert and command
line mode.
:ma[p] [lhs] List mappings (starting with [lhs]) for normal mode.
:ma[p]! [lhs] List mappings (starting with [lhs]) for insert and
command line mode.
:cmap/:cunmap/:cnoremap like map/unmap/noremap but for command line mode only
:imap/:iunmap/:inoremap like map/unmap/noremap but for insert mode only
:mk[exrc][!] [file] write current mappings, abbreviations and settings
to [file] (default ".exrc"; use ! to overwrite)
:mkv[imrc][!] [file] same as :mkexrc, but with default ".vimrc"
Abbreviations
:ab[breviate] {lhs} {rhs} add abbreviation for {lhs} to {rhs}
:ab[breviate] {lhs} show abbreviations that start with {lhs}
:ab[breviate] show all abbreviations
:una[bbreviate] {lhs} remove abbreviation for {lhs}
:iab/:cab/:iunab/:cunab/:noreab/:cnoreab/:inoreab also available!
Options
:se[t] Show all modified options.
:se[t] all Show all options.
:se[t] {option} Set toggle option on, show string or number option.
:se[t] no{option} Set toggle option off.
:se[t] inv{option} invert toggle option.
:se[t] {option}={value} Set string or number option to {value}.
:se[t] {option}? Show value of {option}.
option (shorthand) type default effect
autoindent (ai) toggle off insert mode: copy indent from prev line
autowrite (aw) toggle off write the file when starting a new edit
backspace (bs) number 0 0 standard Vi, 1 delete NL, 2 delete all
backup (bk) toggle on backup a file before overwriting it
backupdir (bdir) string "~/" Unix only: Directory for backup files
binary (bin) toggle off binary file mode
columns (co) number 80 number of columns in the display
compatible (cp) toggle off set options for maximum vi-compatibility
digraph (dg) toggle off enable <BS> digraphs in insert mode
directory (dir) string "" directory to put autoscript file
equalprg (ep) string "indent" program used for '=' command
errorbells (eb) toggle off ring the bell for error messages
errorfile (ef) string "AztecC.Err" file for QuickFix option
option (shorthand) type default effect
errorformat (efm) string format of error messages from compiler
esckeys (ek) toggle on func. keys with <ESC> work in insert mode
expandtab (et) toggle off insert mode: use spaces to enter a tab
exrc toggle off read .exrc/.vimrc from current directory
formatprg (fp) string "" external program for 'Q' command
graphic (gr) toggle off display chars 0x80-0x9f directly
helpfile (hf) string "vim:vim.hlp" name of help file
history (hi) number 20 number of remembered command lines
ignorecase (ic) toggle off ignore case in search patterns
insertmode (im) toggle off start editing in insert mode
joinspaces (js) toggle on insert two spaces after a '.' with join
keywordprg (kp) string "ref" name of program for 'K' command
lines number 25 number of lines in the display
list toggle off display lines in list mode
magic toggle on different pattern matching characters
makeprg (mp) string "make" name of program for ':make' command
modeline (ml) toggle on lines are checked for set commands
modelines (mls) number 5 number of lines checked for set commands
number (nu) toggle off display line numbers
paragraphs (para) string "IPLPPPQPP LIpplpipbp"
nroff macros that separate paragraphs
paste toggle off paste mode: insert literally
option (shorthand) type default effect
readonly (ro) toggle off overwriting the file not allowed
remap toggle on :map command works recursively
report number 2 minimal number of lines for reporting
revins (ri) toggle off insert characters right to left
ruler (ru) toggle off show cursor position in status line
scroll number 12 scroll size for CTRL-U and CTRL-D
scrolljump (sj) number 1 minimal number of lines for scrolling
sections (sect) string "SHNHH HUnhsh" macros separating sections
secure toggle off security checks for .vimrc and .exrc
shell (sh) string "sh" shell to use for ! and :! commands
shelltype (st) number 0 how to use the shell
shiftround (sr) toggle off round indent to shiftwidth with > and <
shiftwidth (sw) number 8 number of spaces to use for (auto)indent
showcmd (sc) toggle on show command in status line
showmatch (sm) toggle off show matching bracket if one is inserted
shortname (sn) toggle off MSDOS-like filesystem being used
showmode (smd) toggle on show insert/replace mode message
sidescroll (ss) number 0 minimal nr of columns for horiz. scroll
smartindent (si) toggle off do smart autoindenting
suffixes (su) string ".bak.o.h.info.vim" suffixes that are ignored
when multiple files match a wildcard
option (shorthand) type default effect
tabstop (ts) number 8 number of spaces that a TAB counts for
taglength (tl) number 0 if non-zero, tags are significant upto
this number of characters
tags string "tags" names of tag files
term string "amiga" name of terminal
textauto (ta) toggle on detect line separator, (re)set 'textmode'
textmode (tx) toggle off use <CR><LF> for line separator
textwidth (tw) number 0 maximum width of a line in insert mode
tildeop (to) toggle off tilde behaves like an operator
timeout toggle on wait only 'tm' msec for mappings&key codes
ttimeout toggle off wait only 'tm' msec for key codes
timeoutlen (tm) number 1000 milliseconds to wait for mappings&key codes
undolevels (ul) number 100 number of changes that can be undone
(0 for Vi compatibility)
visualbell (vb) toggle off use visual instead of audible beep
wildchar (wc) number TAB char used to start filename completion
wrap toggle on when off: horizontal scrolling
wrapmargin (wm) number 0 set textwidth to (columns - wrapmargin)
wrapscan (ws) toggle on searches wrap around the end of the file
writeany (wa) toggle off always write file without asking
writebackup (wb) toggle on backup a file WHILE overwriting it
yankendofline (ye) toggle off 'Y' yanks from cursor to end of line
Undo/Redo commands
N u undo N last changes
N CTRL-R redo N last undone changes
U restore last changed line
External commands
:sh start a shell
:!{command} execute {command} with a shell
K lookup keyword under the cursor with external program
Quickfix commands
:cc [nr] display error [nr] (default is the same again)
:cn display the next error
:cp display the previous error
:cl list all errors
:cf read errors from the error file
:cq quit without writing and return error code (to the compiler)
:make [args] start make, read errors and jump to first error
Various commands
CTRL-L Clear and redraw the screen.
CTRL-G show current file name (with path) and cursor position
CTRL-C during searches: interrupt the search
<DEL> while entering a count: delete last character
:vers show exact version number of this VIM
Command line editing
CTRL-V insert character literally, or enter decimal byte value
<C_LEFT>/<C_RIGHT> cursor left/right
<SC_LEFT>/<SC_RIGHT> cursor one word left/right
CTRL-B/CTRL-E cursor to begin/end of command line
<BS> delete the character in front of the cursor
<DEL> delete the character under the cursor
CTRL-W delete the word in front of the cursor
CTRL-U remove all characters
<C_UP>/<C_DOWN> recall older/newer command line from history
<SC_UP>/<SC_DOWN> recall older/newer command that starts with current command
CTRL-D list filenames that match the pattern in front of the cursor
CTRL-A insert all filenames that match pattern in front of cursor
CTRL-L insert longest common part of filenames that match pattern..
'wildchar' do filename completion on the pattern in front of the cursor
CTRL-N after 'wildchar' with multiple matches: go to next match
CTRL-P after 'wildchar' with multiple matches: go to previous match
<ESC> abandon command line (if 'wildchar' is <ESC> type it twice)
Ex ranges
, separates two line numbers
; idem, set cursor to the first line number
{number} an absolute line number
. the current line
$ the last line in the file
% equal to 1,$ (the entire file)
't position of mark t
/{pattern} the next line where {pattern} matches
?{pattern} the previous line where {pattern} matches
+[num] add [num] to the preceding line number (default 1)
-[num] subtract [num] from the preceding line number (default 1)
Special Ex characters
| separates two commands (not for ":global" and ":!")
" begins comment
# in first column: begins comment
#[number] alternate filename [number] (only where filename is expected)
% current filename (only where filename is expected)
#. idem, but without extension
Editing a file
:e Edit the current file, unless changes have been made.
:e! Edit the current file always. Discard any changes.
:e[dit] {file} Edit {file}, unless changes have been made.
:e[dit]! {file} Edit {file} always. Discard any changes.
N CTRL-^ Edit alternate file N (equivalent to ":e #N").
:pwd Print the current directory name.
:cd [path] Change the current directory to [path].
:f[ile] Print the current filename and the cursor position.
:f[ile] {name} Set the current filename to {name}.
:files Show alternate file names
Using the file list
:ar[gs] Print the file list, with the current file in "[]".
:n[ext] Edit next file, unless changes have been made.
:n[ext]! Edit next file, discard any changes to the buffer.
:n[ext][!] {filelist} Define {filelist} as the new list of files and edit
the first one (see :next for [!]).
:N[ext][!] Edit previous file (see :next for [!]).
:rew[ind][!] Edit first file (see :next for [!]).
:wn[ext][!] Write file and edit next file.
:wn[ext][!] {file} Write to {file} and edit next file, unless {file}
exists. With ! overwrite existing files.
Writing and quitting
:[range]w[rite][!] Write to the current file.
:[range]w[rite] {file} Write to {file}, unless it already exists.
:[range]w[rite]! {file} Write to {file}. Overwrite an existing file.
:[range]w[rite][!] >> Append to the current file.
:[range]w[rite][!] >> {file}
Append to {file}.
:[range]w[rite] !{cmd} Execute {cmd} with [range] lines as standard input.
:q[uit] Quit, unless changes have been made.
:q[uit]! Quit always, discard any changes.
:cq Quit without writing and return error code
:wq[!] Write the current file and exit.
:wq[!] {file} Write to {file} and exit.
:x[it][!] [file] Like ":wq" but write only when changes have been made
ZZ Same as ":x".
:st[op][!] suspend VIM or start new shell. If 'aw' option is set
and [!] not given write the buffer.
CTRL-Z same as ":stop!"
Starting VIM
vim [options] start editing with an empty buffer
vim [options] {file ..} start editing one or more files
vim [options] +[num] {file ..}
idem, put the cursor at line [num] (default last line)
vim [options] +/{pat} {file ..}
idem, put the cursor at the first occurrence of {pat}
vim [options] -t {tag} edit the file associated with {tag}
vim [options] -e [fname] start editing in QuickFix mode, display the first error
options
-v read-only mode (View), implies -n
-b binary mode
-r recover aborted edit, using commands from ".vim" file
-n do not create ".vim" file
-x do not restart VIM to open a window (for e.g. mail)
-s {scriptin} first read the commands in the file {scriptin}
-w {scriptout} write all typed characters to the file {scriptout}
-T {terminal} set terminal type
-d {device} open {device} to be used as a console
automatic option setting when editing a file
vim:{set-arg}: .. In the first and last lines of the file (see 'ml'
option), {set-arg} is given as an argument to :set